/*==============================================================================
 Copyright (c) 2012-2014 Qualcomm Connected Experiences, Inc.
 All Rights Reserved.
 ==============================================================================*/

package com.qualcomm.vuforia.samples.VideoPlayback.ui.ActivityList;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;

import com.qualcomm.vuforia.samples.VideoPlayback.R;

public class AboutScreen extends Activity implements OnClickListener {
	private static final String LOGTAG = "AboutScreen";

	private Button mStartButton;
	private String mClassToLaunch;
	private String mClassToLaunchPackage;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		requestWindowFeature(Window.FEATURE_NO_TITLE);
		getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);

		setContentView(R.layout.about_screen);

		Bundle extras = getIntent().getExtras();
		mClassToLaunchPackage = getPackageName();
		mClassToLaunch = mClassToLaunchPackage + "." + extras.getString("ACTIVITY_TO_LAUNCH");
		
		Log.i(LOGTAG, mClassToLaunchPackage + ":" + mClassToLaunch);

		mStartButton = (Button) findViewById(R.id.button_start);
		mStartButton.setOnClickListener(this);
	}

	// Starts the chosen activity
	private void startARActivity() {
		Intent i = new Intent();
		i.setClassName(mClassToLaunchPackage, mClassToLaunch);
		startActivity(i);
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
		case R.id.button_start:
			startARActivity();
			break;
		}
	}
}
